<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@	taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:url var="baseURI" value="/" />
<c:url var="login" value="/login/toLogin.do"/>
<c:url var="signIn" value="/signIn.do"/>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Insert title here</title>
	<!-- 引入外部CSS -->
	<link rel="stylesheet" type="text/css" href="${baseURI}resources/easyui/themes/metro-green/easyui.css" />
	<link rel="stylesheet" type="text/css" href="${baseURI}resources/easyui/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="${baseURI}resources/css/system.css" />
	<!-- 引入外部JS -->
	<script type="text/javascript" src="${baseURI}resources/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="${baseURI}resources/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${baseURI}resources/js/common.js"></script>
	<script type="text/javascript" src="${baseURI}resources/js/myeasyui.js"></script>
	<script type="text/javascript">
		/**已有账号，跳到登录页*/
		function login(){
			self.location.href='${login}';
		}
		
		/**注册*/
		function register(){
			$('#register_form').form('submit',{
				url : '${signIn}',
				onSubmit : function(){
					return $(this).form('validate');
				},
				success : function(data){
					var $data = $.parseJSON(data);
					// 注册成功，跳转到首页
					if($data.success){
						$.messager.confirm('成功', $data.data, function(r){   
						    if (r){   
						    	self.location.href='${login}';
						    }
						});
					} else{
						$.messager.alert("失败", $data.message + "<br>" + $data.data);
					}
				}
			});
		}
	</script>
</head>

<body>
<div style="width:400px; margin:0 auto; padding-top: 50px;">
	<div class="easyui-panel" title="注册在线考试系统" style="width:100%;padding:30px 50px 20px 50px;">
		<!-- 表单 -->
		<form id="register_form" method="post">
			<input type="hidden" name="paperState" value="0" />
			<div style="margin-bottom:10px;">
				<span style="width: 30%;">账号：&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<input name="account" class="easyui-textbox" style="width:70%;height:30px;padding:12px;" data-options="iconCls:'icon-man',iconWidth:38, required:true">
			</div>
			<div style="margin-bottom:20px">
				<span style="width: 30%">密码：&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<input class="easyui-textbox" type="password" style="width:70%;height:30px;padding:12px" data-options="iconCls:'icon-lock',iconWidth:38, required:true">
			</div>
			<div style="margin-bottom:20px">
				<span style="width: 30%">重复密码：</span>
				<input name="password" class="easyui-textbox" type="password" style="width:70%;height:30px;padding:12px" data-options="iconCls:'icon-lock',iconWidth:38, required:true">
			</div>
			<div style="margin-bottom:20px">
				<span style="width: 30%">姓名：&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<input  name="name" class="easyui-textbox" style="width:70%;height:30px;padding:12px" data-options="required:true">
			</div>
			<div style="margin-bottom:20px">
				<span style="width: 30%">班级：&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<input  name="className" class="easyui-textbox" style="width:70%;height:30px;padding:12px" data-options="required:true">
			</div>
		</form>
		<!-- 按钮 -->
		<div>
			<a href="javascript:register();" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="padding:5px 0px;width:30%;">
				<span style="font-size:14px;">注册</span>
			</a>
			<span style="font-size: 13px;margin-left: 4%">
				已有账号或管理员，直接<a href="javascript:login();">登录</a>
			</span>
		</div>
	</div>
</div>
</body>
